package com.mall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mall.bean.Order;
import com.mall.bean.OrderExample;
import com.mall.dao.OrderMapper;
import com.mall.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lwd1513
 * @date 2022-04-25 15 11
 * discription
 */
@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private  OrderMapper orderMapper;
    @Override
    public int insert(Order order) {
        return 0;
    }

    @Override
    public List<Order> queryData(Order order) {
        return null;
    }

    @Override
    public int update(Order order) {
        return 0;
    }

    @Override
    public int deleteById(String id) {
        return 0;
    }

    @Override
    public Order queryDataById(String id) {
        return null;
    }

    @Override
    public PageInfo<Order> queryDataByPage(int currentPage, int pageSize, Order order) {
        return null;
    }

    @Override
    public PageInfo<Order> queryDataByPageById(String currentPage, String pageSize, String memberId) {
        PageHelper.startPage(Integer.parseInt(currentPage),Integer.parseInt( pageSize));
        OrderExample example = new OrderExample();
        OrderExample.Criteria criteria = example.createCriteria();
        criteria.andMember_idEqualTo(Integer.parseInt(memberId));
        List<Order> orders = orderMapper.selectByExample(example);
        PageInfo<Order> PageInfo = new PageInfo<>(orders);
        return PageInfo;
    }
}
